package com.umeng.fb.a;

import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.util.Log;
import com.umeng.common.b.g;
import com.umeng.fb.util.c;
import java.util.Iterator;
import java.util.Map;
import java.util.Set;
import org.json.JSONArray;
import org.json.JSONException;

public class e extends Thread
{
  static final String a = e.class.getSimpleName();
  Context b;
  String c;
  String d;
  String e;
  int f;
  Handler g;

  public e(Context paramContext)
  {
    this.c = "http://feedback.whalecloud.com/feedback/reply";
    this.f = 0;
    this.b = paramContext;
    this.d = com.umeng.common.b.p(paramContext);
    this.e = com.umeng.common.b.g(paramContext);
  }

  public e(Context paramContext, Handler paramHandler)
  {
    this(paramContext);
    this.g = paramHandler;
  }

  public void run()
  {
    String str1;
    String str2;
    JSONArray localJSONArray;
    String str4;
    Iterator localIterator = this.b.getSharedPreferences("feedback", 0).getAll().keySet().iterator();
    for (Object localObject = ""; ; localObject = localObject + "," + str1)
      while (true)
      {
        if (!(localIterator.hasNext()))
        {
          str2 = this.b.getSharedPreferences("UmengFb_Nums", 0).getString("maxReplyID", "RP0");
          if (!(g.c((String)localObject)))
            break label116;
          return;
        }
        str1 = (String)localIterator.next();
        if (((String)localObject).length() != 0)
          break;
        localObject = str1;
      }
    label116: this.c = this.c + "?appkey=" + this.d + "&feedback_id=" + ((String)localObject);
    if (!(str2.equals("RP0")))
      this.c = this.c + "&startkey=" + str2;
    Log.d(a, this.c);
    String str3 = com.umeng.fb.util.a.a(this.c);
    Intent localIntent = new Intent();
    localIntent.setAction("RetrieveReplyBroadcast");
    if (str3 != null);
    try
    {
      localJSONArray = new JSONArray(str3);
      label252: str4 = c.a(this.b, localJSONArray);
      Log.d(a, "newReplyIds :" + str4);
      if ((str4.length() != 0) && (str4.split(",").length != 0))
        break label338;
      localIntent.putExtra("RetrieveReplyBroadcast", 0);
      label315: this.b.sendBroadcast(localIntent);
      label338: return;
    }
    catch (JSONException localJSONException)
    {
      localJSONException.printStackTrace();
      localJSONArray = null;
      break label252:
      localIntent.putExtra("RetrieveReplyBroadcast", 1);
      if (this.g != null);
      String[] arrayOfString = str4.split(",");
      int i = arrayOfString.length;
      com.umeng.fb.a locala = c.b(this.b, arrayOfString[(i - 1)]).e;
      Message localMessage = new Message();
      Bundle localBundle = new Bundle();
      localBundle.putString("newReplyContent", locala.a());
      localMessage.setData(localBundle);
      this.g.sendMessage(localMessage);
      break label315:
      localIntent.putExtra("RetrieveReplyBroadcast", -1);
    }
  }
}

/* Location:           H:\360云盘\lewa_explorer_3.0\bin\FileApp_orig_dex2jar.jar
 * Qualified Name:     com.umeng.fb.a.e
 * JD-Core Version:    0.5.2
 */